package eiisan.function;

import java.util.function.Function;

/**
 * @author gragonfly
 * @date 2019/7/27
 **/
public class FunctionTest {
    public static void main(String[] args) {
        FunctionTest test = new FunctionTest();
        System.out.println(test.compute(1, value -> {
            return 2 * value;
        }));
        System.out.println(test.compute(1, value -> 6 + value));
        System.out.println(test.comvert(1, value -> value + " hello world"));
    }

    public int compute(int a, Function<Integer, Integer> function) {
        int result = function.apply(a);
        return result;
    }
    public String comvert(int a, Function<Integer, String> function) {
        String result = function.apply(a);
        return result;
    }
}
